<link rel="stylesheet" href="../view/style/kindeditor/themes/default/default.css?<%=timer%>" />
<!--<link rel="stylesheet" href="../view/style/kindeditor/themes/simple/simple.css?<%=timer%>" />-->
<script src="../view/style/kindeditor/kindeditor.js?<%=timer%>"></script>
<script src="../view/style/kindeditor/lang/zh_CN.js?<%=timer%>"></script>
<script>
KindEditor.ready(function(K){
	var config = {
		//themeType: 'simple',
		urlType: 'domain',
		uploadJson: "./upload.asp",
		fileManagerJson: "./file_manage.asp",
		allowFileManager: true
	};
	K.create('textarea', config);
	$(".ke-edit-iframe").on("load", function(){
		var sel = $(this), ifm = sel.contents(), htm = $(".ke-edit,.ke-edit-textarea"), h;
		$(this.contentWindow).on("scroll", function(){
			sel.animate({height: h = ifm.height()}, 600, function(){htm.height(h)});
		});
	});
	//批量上传图片的删除动作
	K.swfUploadDelete = function (a) {
		var img = K('img', a), status = img.attr('data-status');
		if(status == '-4') { //只删除上传成功的
			$.post('./file.asp?q=delete', {filename: img.attr('src')});
		}
	};
	var editor = K.editor(config);
	K(".selectPicUrl").click(function() {
		var self = $(this), thumb_img = self.siblings('img.thumb_img'),
			picUrl = self.siblings('input[name="picUrl"]');
		editor.loadPlugin("image", function() {
			editor.plugin.imageDialog({
				imageUrl: picUrl.val(),
				clickFn: function(a) {
					picUrl.val(a);
					thumb_img.attr('src', a);
					editor.hideDialog();
				}
			});
		});
	});
});
</script>